package com.quydat.forum.entites;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the category database table.
 * 
 */
@Entity
@Table(name="category")
@NamedQuery(name="Category.findAll", query="SELECT c FROM CategoryEntity c")

public class CategoryEntity implements Serializable {
	private static final long serialVersionUID = 1L;
/**
 * Named Queries
 */
	public static final String findAll="Category.findAll";
	@Id
	@SequenceGenerator(name="CATEGORY_ID_GENERATOR", sequenceName="CATEGORY_SEQ")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CATEGORY_ID_GENERATOR")
	@Column(unique=true, nullable=false)
	private Integer id;

	@Column(length=2147483647)
	private String name;

	//bi-directional many-to-one association to SubCategoryEntity
	@OneToMany(mappedBy="category")
	private List<SubCategoryEntity> subCategories;

    public CategoryEntity() {
    }

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<SubCategoryEntity> getSubCategories() {
		return this.subCategories;
	}

	public void setSubCategories(List<SubCategoryEntity> subCategories) {
		this.subCategories = subCategories;
	}
	
}